I want to be able to blit text (shapes) out in any color I
like. I use a 16-colour screen, and I CAN get it to print out
in about 5 different colours using more or less random use of
the ExecessOn/Off flag in the Blit command... But I need to
be able to blit it out in ANY colour of the 16, and have
totalt control. Does anybody know how to to it??
Uhr, what you are trying to say is that you have a whole bunch of shapes which represent text (or characters), right ? I assume these shapes have a depth of one bitplane ? If this is so, it pretty much complicates things, but don't worry: blitting in any color is possible.
You see, to create a color, you have to blit into all 4 of your bitplanes. In your color is 6, you need to draw into bitplanes 1 and 2, and erase from bitplanes 0 and 3 ! But, you can't do this with the ExcessOn/Off flag. Fortunately BB2 has a command called "BitplanesBitmap". This sets up a fake bitmap from one or more of your planes. Blitting to this fake bitmap only affects the bitplanes you selected. So, to write your text in color 6, you set up such a fake bitmap, which only holds bitplanes 1 and 2. And then you blit to this bitmap.
This is all fairly easy, but there is a catch (of course there is, there always is a catch). You also need to erase the shape from the planes you do not blit in. Suppose there is a circle on screen in color 1. This means that a big part of bitplane 0 is filled with 1's. If you want to blit your text in color 6, you draw into bitplanes 1 and 2, like described above. But what's on screen isn't color 6, but color 7. That's because bitplanes 0, 1 and 2 have all ones in them, which makes up color 7. I hope this makes it clear that you have to erase as well.
You can erase your shape from a bitplane by blitting it's inverse into the plane. This means you have to have another set of shapes, which are the inverses of your original shapes. With inverse I mean this:
On the left you can see the original, on the right the inverse.
(The white is for set pixels, black is for cleared pixels)
Of course you can select the planes in which you want to erase
again by using the BitplanesBitmap command.
You can also do all of this by directly manipultating the blitter of course, but that's pretty hard to understand if you're not an assembly-coder, so I suggest you first try this method. If you can't figure out how it works, then let me know, and I'll see if I can write a small example program for you. But to really know what you're doing, try it yourself!
You do the Gosub .assem in your initialisation (the only time you need to use Getreg), and then can access your variable both from Blitz and assembler in your main loop. There should be no slow down in the assembler code because you are saving your variables (regs) normally.
OK here's another little routine that I use for a music-disk. Not very advanced, but it does a good job, fading between two palettes. I haven't been able to make Blitz do that using FadePalette or other palette-commands - it can only fade up from black to a palette.
This statement can fade between two palettes. You need to define three arrays first:
Dim palsr(#COLORS-1),palsg(#COLORS-1),palsb(#COLORS-1) ; Palette Arrays. Syntax: FadePals {source palette,destination palette,delay}An example of how to setup a Dual Play Field screen for AGA Amigas (16+16 colors) plus three 16 color AGA sprites.
Take a look.What follows is the only bit of half decent info on the FMODE register that I could find. Hope it helps and if you suss anything out, please let me know.
The Magic FMode Register (from howtocode6.txt)If you set your 1200/4000 to a hiresmode (such as 1280x512 Superhires 256 colours) and disassemble the copperlist, you find fun things happen to the FMODE register ($dff1fc). The FMODE register determines the amount of words transferred between chipram and the Lisa chip in each data fetch. NOTE: Using a data fetch > 0 in standard LOWRES or in hires resolutions, the COPPERLIST will be faster (will leave free more time for the 680x0 and blitter), but the BLITTER speed is the SAME.
$dff1fc bits 0 and 1 value*ALL* ECS and lower screenmodes require only 1x datafetch. All modes run *FASTER* with at least 2x bandwidth, so try and use 2x bandwitdh if possible.
Bits 2 and 3 do the same for sprite width, as has been mentioned elsewhere...
Remember... To take advantage of the increased fetchmodes (which give you more processor time to play with!) your bitmaps must be on 64-bit boundaries and be multiples of 64-bits wide (8 bytes)
This is an example of how to cut a 32 pixel diameter circle from a source bitmap, and paste this into a destination bitmap without causing any corruption.
Take a look.The set-up commands taken by an old demo by Acid guys (the only way to understand how to use them!!!!)
Take a look.How do I poke.b higher than 127 (up to 255). I used to do it in AXXs all of the time, that's how Scene Editor worked. I know that I could use poke.w instead but that would waste a lot of memory.
Try some assembler:Well, you might wanna make a game that uses 2 mice, like Settlers or Lemmings. Anyway, here is a bit of source that let's you read both mouseports.
Take a look.for my part, I can get it going really well in *one* direction but cant figure how to reverse it, its OK going from one end to another but how do you reverse in the middle, e.g, an object that could switch directions at will ????
Well done in getting it going in one direction! - that's half the battle! Now for the other half. To go in the other direction you just do the opposite ie: put blocks ahead and behind as before, but assuming we're going left now, you put one block 21 blocks (21*16 pixels) to the left and one block, one block (1*16 pixels) behind you. The last half of the battle (wot 3 halfs? - I never said it was easy!) is getting the bugs out switching from one side to the other.
Here's the main bits. There's a fair bit of setup code not here (I'll have to extract it), but hopefully this helps.
Take a look.This code is efficient, but I'm about to fix it up, and make it a bit faster- enjoy :-)
Or maybe something like 'Project Buzzbar' as per the BUM disks, but with a much larger playfield ???????????? What do you think ???
Well the problem with that sort of thing is your background is limited to the size of your bitmap. Updating with a map means you can have massive background areas to scroll around in (essential for platform games or shoot-em-ups). The only memory needed being for the double wide bitmaps (or quadruple for 8-way). To do the same thing Buzzbar style would require ridiculous amounts of memory. So it depends on what sort of game you want to make (Buzzbar's a fun game!).